#include <memory>
#include <iostream>

class Base {
public:
    virtual void perform() { std::cout << "Base action\n"; }
    virtual ~Base() {}
};

class Derived : public Base {
public:
    void perform() override { std::cout << "Derived action\n"; }
};

int main() {
    std::shared_ptr<Derived> derivedPtr = std::make_shared<Derived>();
    std::shared_ptr<Base> basePtr = std::static_pointer_cast<Base>(derivedPtr);

    basePtr->perform(); // 输出 "Derived action"
    return 0;
}